import './utils/system.copyright'
import ElementPlus from 'element-plus'
import VXETable from 'vxe-table'
import Vue3BaiduMapGL from 'vue3-baidu-map-gl'
import BaiduMap from 'vue-baidu-map-3x'
import App from './App.vue'
import pinia from './store'
import router from './router'
import { useI18n } from './locales'

// 自定义指令
import { selectDictLabel } from './utils/customer'
import { listDictDataByDictHeaderValue } from './api/dict_item'
import directive from '@/utils/directive'

// 错误日志上报
import errorLog from '@/utils/error.log'

// 加载 svg 图标
import 'virtual:svg-icons-register'

// 加载 iconify 图标
import { downloadAndInstall } from '@/iconify'
import icons from '@/iconify/index.json'

// 全局样式
import 'uno.css'
import '@/assets/styles/globals.scss'
import 'vxe-table/lib/style.css'

const app = createApp(App)
app.config.globalProperties.getDicts = listDictDataByDictHeaderValue
app.config.globalProperties.selectDictLabel = selectDictLabel
app.use(VXETable)
app.use(Vue3BaiduMapGL)
app.use(BaiduMap, {
  // ak 是在百度地图开发者平台申请的密钥 详见 http://lbsyun.baidu.com/apiconsole/key */
  ak: '05UpzezEEczsCBgeK1m2LpOcznLuyjY3',
  // v:'2.0',  // 默认使用3.0
  // type: 'WebGL' // ||API 默认API  (使用此模式 BMap=BMapGL)
})
app.use(ElementPlus)
app.use(pinia)
app.use(router)
useI18n(app)
directive(app)
errorLog(app)
if (icons.useType === 'offline') {
  for (const info of icons.collections) {
    downloadAndInstall(info)
  }
}

app.mount('#app')
